{% extends "base.html" %}

{% block title %}
优质异性
{% endblock %}

{% block h_s %}
    active
{% endblock %}
{% block body %}
 <form action="{% url "h_s" %}" method="post">
 {% csrf_token %}
    <table>
        <tr>
            <td >姓名</td>
            <td>性别</td>
            <td><select name="age">
                    <option value="错误">年龄</option>
                    {% for q in a %}
                    <option value="{{ q.age }}">{{ q.age }}</option>
                    {% endfor %}
            </select></td>
            <td>图片</td>
            <td><select name="money">
                    <option value="错误">年收入</option>
                    {% for q in a %}
                    <option value="{{ q.money }}">{{ q.money }}</option>
                    {% endfor %}
            </select></td>
            <td><select name="married">
                    <option value="错误">婚姻状况</option>
                    <option value="离异">离异</option>
                    <option value="未婚">未婚</option>
            </select></td>
            <td><select name="children">
                    <option value="错误">子女</option>
                    <option value="有">有</option>
                    <option value="无">无</option>
            </select></td>
            <td><select name="house">
                    <option value="错误">房产</option>
                    {% for q in a %}
                    <option value="{{ q.house }}">{{ q.house }}</option>
                    {% endfor %}
            </select></td>
            <td>进行操作</td>
            <td>进行操作</td>
            <td><input type="submit" value="进行筛选"></td>
        </tr>
    {% if inf %}
        {% for f in inf %}
            <tr>
                <td>{{ f.name }}</td>
                <td>{{ f.sex }}</td>
                <td>{{ f.age }}</td>
                <td><a href="http://127.0.0.1:8000/media/{{ f.photo }}">点此查看</a></td>
                <td>{{ f.money }}</td>
                <td>{{ f.married }}</td>
                <td>{{ f.children }}</td>
                <td>{{ f.house }}</td>
                <td><a href="{% url "collect_r" cid=f.id %}">收藏</a></td>
                <td><a href="{% url "leave" cid=f.id %}">对他/她留言</a></td>
            </tr>
        {% endfor %}
        
        {% else %}
         {% for u in a %}
            <tr>
                <td>{{ u.name }}</td>
                <td>{{ u.sex }}</td>
                <td>{{ u.age }}</td>
                <td><a href="http://127.0.0.1:8000/media/{{ u.photo }}">点此查看</a></td>
                <td>{{ u.money }}</td>
                <td>{{ u.married }}</td>
                <td>{{ u.children }}</td>
                <td>{{ u.house }}</td>
                <td><a href="{% url "collect_r" cid=u.id %}">收藏</a></td>
                <td><a href="{% url "leave" cid=u.id %}">对他/她留言</a></td>
            </tr>
        {% endfor %}
    {% endif %}
       

    </table>
     </form>
{% endblock %}
{% block head %}
    <style>
        td{
            width: 128px;
            height: 30px;
            text-align: center
        }
    </style>
{% endblock %}